<%
'GET FORM VALUES
	newLname = Request("lname")
	newFname = Request("fname")
	newAddress = Request("address")
	newCity = Request("city")
	newState = Request("state")
	newZip = Request("zip")
	newPhone = Request("phone")
	newEmail = Request("email")
	
'CONNECT TO DATABASE

	dbPath = "db/contacts.mdb"

	Set conn = Server.CreateObject("ADODB.Connection")
	MdbFilePath = Server.MapPath(dbPath)
	conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"

'INSERT DATA INTO DATABASE
	SQL_stmt = "INSERT INTO People (LastName,FirstName,StreetAddress,City,State,ZipCode,PhoneNo,EmailAddress)"
	SQL_stmt = SQL_stmt & " VALUES ('" & newLname & "','" & newFname & "','" & newAddress & "','" & newCity & "','" & newState & "','" & newZip
	SQL_stmt = SQL_stmt & "','" & newPhone & "','" & newEmail & "')"
	set RS = conn.execute(SQL_stmt)

'CLOSE DATABASE CONNECTION
	conn.close
	set conn = nothing
	set sqlstmt = nothing

'REDIRECT TO FULL LISTING
	'newPage = "index.asp"
	'Response.Redirect (newPage)
	
	newPage = "add_contact_success.asp"
	Response.Redirect (newPage)
%>